//
//  ApplyForViewController.m
//  DA_V
//
//  Created by 中亿世联前台 on 15/4/24.
//  Copyright (c) 2015年 zhouhai. All rights reserved.
//

#import "ApplyForViewController.h"
#import "ApplyforView.h"
#import "InterFace.h"
#import "UIViewAdditions.h"
#import "ApplyForSuccessController.h"
@interface ApplyForViewController ()<UITextViewDelegate,UITextFieldDelegate>
@property (nonatomic,strong) UIScrollView *mainmainScrollView;
@end

@implementation ApplyForViewController
@synthesize nameTextField,mobileTextField,addressTextView,weChatTextField,loginTextField,recommendTextView;
- (void)viewDidLoad {
    [super viewDidLoad];
    self.navigationController.navigationBarHidden=YES;
    self.view.backgroundColor = [self colorWithHexString:@"#F5F5F5"];
    
    self.mainmainScrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT)];
    if (SCREEN_HEIGHT < 568) {
        self.mainmainScrollView.contentSize = CGSizeMake(SCREEN_WIDTH, SCREEN_HEIGHT*1.2);
    }
    [self.view addSubview:self.mainmainScrollView];
    
    [self initNav];
    navTitle.text = @"申请微商账户";
    [self createBaceView];
}
#pragma mark - 返回
-(void)clickBackBtn{
    [self.navigationController popViewControllerAnimated:YES];
}
#pragma -matk 创建申请View
- (void)createBaceView{
    
    //    self.applyForView =  (ApplyforView *)[[[NSBundle mainBundle] loadNibNamed:@"GeRen_xibs" owner:self options:nil] objectAtIndex:3];
    //
    //    self.applyForView.frame = CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
    //    [self.mainmainScrollView addSubview:self.applyForView];
    
    UIView *backgroundView = [[UIView alloc]initWithFrame:CGRectMake(0, navView.bottom, SCREEN_WIDTH, SCREEN_HEIGHT*0.75)];
    backgroundView.backgroundColor = [UIColor whiteColor];
    backgroundView.userInteractionEnabled = YES;
    [self.view addSubview:backgroundView];
    
    UIImageView *loginPwdB = [[UIImageView alloc] initWithFrame:CGRectMake(10,20, SCREEN_WIDTH-20, SCREEN_HEIGHT*0.07)];
    //loginPwdBG.image = [UIImage imageNamed:@"updatepassword_03"];
    loginPwdB.backgroundColor = [UIColor whiteColor];
    loginPwdB.layer.borderColor = [UIColor grayColor].CGColor;
    loginPwdB.layer.borderWidth = 0.5;
    loginPwdB.userInteractionEnabled = YES;
    [backgroundView addSubview:loginPwdB];
    
    
    nameTextField = [[UITextField alloc] initWithFrame:CGRectMake(10, 0 ,loginPwdB.frame.size.width-20 , SCREEN_HEIGHT*0.07)];
    nameTextField.tag = 1;
    nameTextField.placeholder = @"姓名";
    nameTextField.font = [UIFont systemFontOfSize:14];
    //writePhoneNum.backgroundColor= [UIColor whiteColor];
    [loginPwdB addSubview:nameTextField];
    nameTextField.delegate = self;
    
    UIImageView *loginPwdB1 = [[UIImageView alloc] initWithFrame:CGRectMake(10,loginPwdB.bottom+10, SCREEN_WIDTH-20, SCREEN_HEIGHT*0.07)];
    //loginPwdBG.image = [UIImage imageNamed:@"updatepassword_03"];
    loginPwdB1.backgroundColor = [UIColor whiteColor];
    loginPwdB1.layer.borderColor = [UIColor grayColor].CGColor;
    loginPwdB1.layer.borderWidth = 0.5;
    loginPwdB1.userInteractionEnabled = YES;
    [backgroundView addSubview:loginPwdB1];
    
    
    mobileTextField = [[UITextField alloc] initWithFrame:CGRectMake(10, 0 ,loginPwdB1.frame.size.width-20 , SCREEN_HEIGHT*0.07)];
    mobileTextField.tag = 2;
    mobileTextField.placeholder = @"手机号";
    mobileTextField.font = [UIFont systemFontOfSize:14];
    //writePhoneNum.backgroundColor= [UIColor whiteColor];
    [loginPwdB1 addSubview:mobileTextField];
    mobileTextField.delegate = self;
    
    
    
    
    
    UIImageView *loginPwdB2 = [[UIImageView alloc] initWithFrame:CGRectMake(10,loginPwdB1.bottom+10, SCREEN_WIDTH-20, SCREEN_HEIGHT*0.09)];
    //loginPwdBG.image = [UIImage imageNamed:@"updatepassword_03"];
    loginPwdB2.backgroundColor = [UIColor whiteColor];
    loginPwdB2.layer.borderColor = [UIColor grayColor].CGColor;
    loginPwdB2.layer.borderWidth = 0.5;
    loginPwdB2.userInteractionEnabled = YES;
    [backgroundView addSubview:loginPwdB2];
    
    
    addressTextView = [[UITextView alloc] initWithFrame:CGRectMake(5, 0 ,loginPwdB2.frame.size.width-20 , SCREEN_HEIGHT*0.09)];
    addressTextView.text = @"地址";
    addressTextView.textColor = [UIColor lightGrayColor];
    addressTextView.font = [UIFont systemFontOfSize:14];
    //writePhoneNum.backgroundColor= [UIColor whiteColor];
    [loginPwdB2 addSubview:addressTextView];
    addressTextView.delegate = self;
    
    UIImageView *loginPwdB3 = [[UIImageView alloc] initWithFrame:CGRectMake(10,loginPwdB2.bottom+10, SCREEN_WIDTH-20, SCREEN_HEIGHT*0.07)];
    //loginPwdBG.image = [UIImage imageNamed:@"updatepassword_03"];
    loginPwdB3.backgroundColor = [UIColor whiteColor];
    loginPwdB3.layer.borderColor = [UIColor grayColor].CGColor;
    loginPwdB3.layer.borderWidth = 0.5;
    loginPwdB3.userInteractionEnabled = YES;
    [backgroundView addSubview:loginPwdB3];
    
    
    loginTextField = [[UITextField alloc] initWithFrame:CGRectMake(10, 0 ,loginPwdB3.frame.size.width-20 , SCREEN_HEIGHT*0.07)];
    loginTextField.placeholder = @"登录密码";
    loginTextField.font = [UIFont systemFontOfSize:14];
    //writePhoneNum.backgroundColor= [UIColor whiteColor];
    [loginPwdB3 addSubview:loginTextField];
    loginTextField.delegate = self;
    
    UIImageView *loginPwdBb = [[UIImageView alloc] initWithFrame:CGRectMake(10,loginPwdB3.bottom+10, SCREEN_WIDTH-20, SCREEN_HEIGHT*0.07)];
    //loginPwdBG.image = [UIImage imageNamed:@"updatepassword_03"];
    loginPwdBb.backgroundColor = [UIColor whiteColor];
    loginPwdBb.layer.borderColor = [UIColor grayColor].CGColor;
    loginPwdBb.layer.borderWidth = 0.5;
    loginPwdBb.userInteractionEnabled = YES;
    [backgroundView addSubview:loginPwdBb];
    
    
    weChatTextField = [[UITextField alloc] initWithFrame:CGRectMake(10, 0 ,loginPwdBb.frame.size.width-20 , SCREEN_HEIGHT*0.07)];
    weChatTextField.placeholder = @"微信号（选填）";
    weChatTextField.font = [UIFont systemFontOfSize:14];
    //writePhoneNum.backgroundColor= [UIColor whiteColor];
    [loginPwdBb addSubview:weChatTextField];
    weChatTextField.delegate = self;
    
    
    UIImageView *loginPwdB4 = [[UIImageView alloc] initWithFrame:CGRectMake(10,loginPwdBb.bottom+10, SCREEN_WIDTH-20, SCREEN_HEIGHT*0.07)];
    //loginPwdBG.image = [UIImage imageNamed:@"updatepassword_03"];
    loginPwdB4.backgroundColor = [UIColor whiteColor];
    loginPwdB4.layer.borderColor = [UIColor grayColor].CGColor;
    loginPwdB4.layer.borderWidth = 0.5;
    loginPwdB4.userInteractionEnabled = YES;
    [backgroundView addSubview:loginPwdB4];
    
    
    recommendTextView = [[UITextField alloc] initWithFrame:CGRectMake(10, 0 ,loginPwdB4.frame.size.width-20 , SCREEN_HEIGHT*0.07)];
    recommendTextView.placeholder = @"推荐人手机号（选填）";
    recommendTextView.font = [UIFont systemFontOfSize:14];
    //writePhoneNum.backgroundColor= [UIColor whiteColor];
    [loginPwdB4 addSubview:recommendTextView];
    recommendTextView.delegate = self;
    
    
    UIButton *belowBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    belowBtn.frame = CGRectMake(0.03125*SCREEN_WIDTH, loginPwdB4.bottom+15, SCREEN_WIDTH*0.9375, SCREEN_WIDTH*0.125);
    [belowBtn setBackgroundImage:[UIImage imageNamed:@"申请微商资格_09"] forState:UIControlStateNormal];
    [belowBtn addTarget:self action:@selector(clickRightBtn) forControlEvents:UIControlEventTouchUpInside];
    [backgroundView addSubview:belowBtn];
    
    UIButton *loginBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    loginBtn.frame = CGRectMake(SCREEN_WIDTH-0.0625*SCREEN_WIDTH-28, belowBtn.bottom+10, 28, 20);
    [loginBtn setTitle:@"登录" forState:UIControlStateNormal];
    [loginBtn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
    [loginBtn addTarget:self action:@selector(clickLoginBtn) forControlEvents:UIControlEventTouchUpInside];
    loginBtn.titleLabel.font = [UIFont systemFontOfSize:14];
    [backgroundView addSubview:loginBtn];
    
}
#pragma mark - 登录
-(void)clickLoginBtn{
    [self.navigationController popViewControllerAnimated:YES];
}
-(void)clickRightBtn{
    ApplyForSuccessController *success = [[ApplyForSuccessController alloc]init];
    [self.navigationController pushViewController:success animated:YES];
}
@end
